package com.ruoyi.back.controller

import com.ruoyi.app.common.Data
import com.ruoyi.back.domain.UrlShare
import com.ruoyi.back.service.UrlShareService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("system/urlShare")
@Api(tags = ["链接分享api"])
class UrlShareController {

    @Autowired
    private lateinit var urlShareService: UrlShareService


    @ApiOperation("保存链接分享")
    @PostMapping("save")
    fun saveUrlShare(@RequestBody urlShare: UrlShare): Data<Boolean> = urlShareService.saveUrlShare(urlShare)

    @ApiOperation("获取链接分享")
    @PostMapping("get/{channelType}")
    fun getUrlShare(@PathVariable channelType: Int): Data<UrlShare> = urlShareService.getUrlShare(channelType)
}